<div id="<%= widget_result_id %>"></div>
<%= form_tag '/users/reset_password', :remote => true, :id => 'reset_password_form', :class => "form-signin" do %>
    <input name="login" type="text" class="form-control" placeholder="Username / Email Address" required autofocus>
    <br/>

    <p class="text-center">
      <button class="btn btn-lg btn-primary btn-block" type="submit">Submit</button>
      <%= link_to 'Cancel', 'home' %>
    </p>
    <input type="hidden" name="reset_password_url" value="<%= @reset_password_url %>"/>
    <input type="hidden" name="domain" value="<%= @domain %>"/>
<% end %>

<script type="text/javascript">
    jQuery('#reset_password_form').bind('ajax:success', function (e, response) {
        var html = '';

        if (response.success) {
            html = [
                '<div class="alert alert-success" >',
                '<button type="button" class="close" data-dismiss="alert">&times;</button>',
                response.message,
                '</div>'
            ].join('');
        }
        else {
            html = [
                '<div class="alert alert-danger" >',
                '<button type="button" class="close" data-dismiss="alert">&times;</button>',
                response.message,
                '</div>'
            ].join('');
        }

        jQuery('#<%=widget_result_id%>').html(html);
    });
</script>